package io.github.uicdb.badskill.clent;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import io.github.uicdb.badskill.BadSkill;
import io.github.uicdb.badskill.clent.impl.AttributeScreen;
import io.github.uicdb.badskill.clent.impl.SkillScreen;
import io.github.uicdb.badskill.network.NetWorking;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.client.event.RegisterShadersEvent;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.lwjgl.glfw.GLFW;

import java.io.IOException;

@Mod.EventBusSubscriber(modid = BadSkill.MODID,value = Dist.CLIENT,bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ClientHandles {

    @SubscribeEvent
    public static void onClientTick(TickEvent.ClientTickEvent event) {
        if(event.phase== TickEvent.Phase.END) {
            while (ModInputs.OPEN_SKILL_PANEL.consumeClick()) {
                var sc = new SkillScreen();
                Minecraft.getInstance().setScreen(sc);
            }
            while (ModInputs.OPEN_ATTRIBUTE_PANEL.consumeClick()){
                var sc=new AttributeScreen();
                Minecraft.getInstance().setScreen(sc);
            }
        }
    }
    @Mod.EventBusSubscriber(modid = BadSkill.MODID,value = Dist.CLIENT,bus =Mod.EventBusSubscriber.Bus.MOD)
    public static class ModHandle{

        @SubscribeEvent
        public static void onLoadShaders(RegisterShadersEvent event){

        }

        @SubscribeEvent
        public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) {
            ModInputs.ALL_KEY_MAPPINGS.forEach(event::register);
        }
    }
}
